package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

// 活动套餐表项目表
@JsonApiResource(type = "customeractivitypackageitem")
@Table(name = "tnb_customer_activity_package_item")
@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class CustomerActivityPackageItem extends BaseEntity {

	private Integer createDateTime;// 创建时间
	
	private CustomerActivityPackage acitivityPackage;// 套餐项目ID
	
	private CustomerActivityServiceItem activityServiceItem;// 项目活动ID activityServiceItemID
	
	private String remark;// 备注

	private Dicttype period;// 周期

	private String frequency;// 频次
	
	@Column(name = "frequency")
	public String getFrequency() {
		return frequency;
	}

	public void setFrequency(String frequency) {
		this.frequency = frequency;
	}
	
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "period_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getPeriod() {
		return period;
	}

	public void setPeriod(Dicttype period) {
		this.period = period;
	}
	
	@Column(name = "createDateTime")
	public Integer getCreateDateTime() {
		return createDateTime;
	}

	public void setCreateDateTime(Integer createDateTime) {
		this.createDateTime = createDateTime;
	}
	
	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}
	
	public void setRemark(String remark) {
		this.remark = remark;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
    @Fetch(FetchMode.JOIN)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "packageID", foreignKey = @ForeignKey(name = "null"))
	public CustomerActivityPackage getAcitivityPackage() {
		return acitivityPackage;
	}

	public void setAcitivityPackage(CustomerActivityPackage acitivityPackage) {
		this.acitivityPackage = acitivityPackage;
	}
	
	@JsonApiToOne
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "activityServiceItemID", foreignKey = @ForeignKey(name = "null"))
	public CustomerActivityServiceItem getActivityServiceItem() {
		return activityServiceItem;
	}
	
	public void setActivityServiceItem(CustomerActivityServiceItem activityServiceItem) {
		this.activityServiceItem = activityServiceItem;
	}
}
